/*
 * @ClassName test_router.dart
 * @Description 测试页面的路由
 * @Author SuPeiSen
 * @Date 2020/7/17 17:47
 */

import 'package:fluro/fluro.dart';
import 'package:fluro/src/router.dart';
import 'package:flutter_su/pages/test/api_test.dart';
import 'package:flutter_su/pages/test/router_test.dart';
import 'package:flutter_su/pages/test/show_test.dart';
import 'package:flutter_su/pages/test/test_page.dart';
import 'package:flutter_su/router/base_router.dart';

class TestRouter with BaseRouter {
  static const String TEST_PAGE = "/testPage";
  static const String API_TEST = "/apiTest";
  static const String SHOW_TEST = "/showTest";
  static const String ROUTER_TEST = "/router_test";
  static const String ROUTER_SECOND_TEST = "/router_second_test";

  @override
  void initRouter(Router router) {
    // 测试页面路由
    router.define(
      TEST_PAGE,
      handler: Handler(handlerFunc: (_, params) => TestPage()),
    );
    // 接口测试页面
    router.define(
      API_TEST,
      handler: Handler(handlerFunc: (_, params) => ApiTest()),
    );
    // 弹窗测试页面
    router.define(
      SHOW_TEST,
      handler: Handler(handlerFunc: (_, params) => ShowTest()),
    );
    // 路由动画测试
    router.define(
      ROUTER_TEST,
      handler: Handler(handlerFunc: (_, params) => RouterTest()),
    );
    // 路由动画测试
    router.define(
      ROUTER_SECOND_TEST,
      handler: Handler(handlerFunc: (_, params){
        String title = params['title']?.first;
        return RouterSecondTest(title: title,);
      }),
    );
  }
}
